<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增支付记录')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-payrecord-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">用户:</label>
                <div class="col-sm-8">
                    <!--<input name="userId" class="form-control" type="text" required>-->
                    <div class="input-group">
                        <input id="userId" name="userId" type="hidden" class="form-control" />
                        <input id="userName" name="userName" class="form-control" type="text" onclick="selectUserTree()" readonly="true"  required>
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">订单id：</label>
                <div class="col-sm-8">
                    <input name="orderId" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">支付金额：</label>
                <div class="col-sm-8">
                    <input name="payNum" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">支付渠道：</label>
                <div class="col-sm-8">
                    <input name="payChannel" class="form-control" type="text" required>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "gzbook/payrecord"
        $("#form-payrecord-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-payrecord-add').serialize());
            }
        }

        /*用户-新增-选择用户树*/
        function selectUserTree() {
            var userId = $("#userId").val();
            userId = 1;
            var options = {
                title: '用户选择',
                width: "380",
                url: ctx + "gzbook/userinfo/selectUser/" + userId,
                callBack: doSubmitU
            };
            $.modal.openOptions(options);
        }

        function doSubmitU(index, layero){
            var body = $.modal.getChildFrame(index);
            $("#userId").val(body.find('#treeId').val());
            $("#userName").val(body.find('#userName').val());
            $.modal.close(index);
        }






    </script>
</body>
</html>